Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canvas: Add tooltip for data links #61648

Merged
merged 11 commits into from
Jan 20, 2023
Merged

Conversation

adela-almasan
Copy link
Contributor

@adela-almasan adela-almasan commented Jan 17, 2023

data_links_tooltip.mov

Fixes #61415
Fixes #57376

Special notes for your reviewer:

  • appears if inline edit is turned off and there are data links to be displayed for an element
  • hover will show the tooltip in the top right corner of an element, click will make it stay open
  • only for text and metric value elements for now
  • needs UX 👀

@adela-almasan adela-almasan added this to the 9.4.0 milestone Jan 17, 2023
@adela-almasan adela-almasan self-assigned this Jan 17, 2023
@adela-almasan adela-almasan requested a review from a team January 17, 2023 22:41
@nmarrs
Copy link
Contributor

nmarrs commented Jan 19, 2023

Great job on this! Just noticed one UX issue that we may want to try and get right out of the gate.

We currently display the tool tip on mouse enter / exit - it may potentially make more sense to display the tooltip based on hover instead so that tooltip follows the cursor

E.g. I see the tooltip pop up and go to click the link and it disappears as I am triggering the mouse leave on the element - vs the tool tip follows the cursor it is less likely to click somewhere / cause tool tip to disappear by trying to click the data link. Thoughts? We probably can leave as is but doesn't feel as intuitive to me

Screen.Recording.2023-01-19.at.12.17.44.PM.mov

@adela-almasan
Copy link
Contributor Author

I see what you mean, it was intentional but we can definitely discuss it further. My reasoning -

  • I tried to follow the same pattern as in Geomap&co - mouse enter just displays the tooltip, if you actually want to click the link you have to click once to keep the tooltip opened
  • I tried avoiding following the cursor as it looks a bit weird (imo) considering the hovering area is bigger (eg. metric-value); also if the tooltip is wider (long data link names) it can cover up (almost) entirely the element - that's why I chose to display it in the top-right corner of an element
  • Discussed with @ryantxu about adding an icon in a future iteration to show the tooltip also when editing, it felt like a smaller adjustment to me

But if it makes more sense to you, we can give it a try - it's a quick change! 😁

@nmarrs
Copy link
Contributor

nmarrs commented Jan 20, 2023

I see what you mean, it was intentional but we can definitely discuss it further. My reasoning -

  • I tried to follow the same pattern as in Geomap&co - mouse enter just displays the tooltip, if you actually want to click the link you have to click once to keep the tooltip opened
  • I tried avoiding following the cursor as it looks a bit weird (imo) considering the hovering area is bigger (eg. metric-value); also if the tooltip is wider (long data link names) it can cover up (almost) entirely the element - that's why I chose to display it in the top-right corner of an element
  • Discussed with @ryantxu about adding an icon in a future iteration to show the tooltip also when editing, it felt like a smaller adjustment to me

But if it makes more sense to you, we can give it a try - it's a quick change! 😁

I think your approach is reasonable - in future it is a quick change so we can try it out in its current iteration :) This interaction is a little tricky so either way there are potentially tradeoffs - though like you mentioned this way at least the element will never be covered up fully. Great job on this feature!

Copy link
Contributor

@nmarrs nmarrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adela-almasan adela-almasan enabled auto-merge (squash) January 20, 2023 16:14
@adela-almasan adela-almasan merged commit cef1587 into main Jan 20, 2023
@adela-almasan adela-almasan deleted the 60778_canvas_tooltip_data_link branch January 20, 2023 16:26
@dsotirakis dsotirakis modified the milestones: 9.4.0, 9.4.0-beta1 Jan 30, 2023
@ChristophEbler
Copy link

Hi @adela-almasan , @nmarrs thanks a lot for implementing this feature. This is what I had in mind. I'm Using an Influx db Database as a data source and running multiple queries to select the data I want to display in different Metric value elements. To get the Data link feature to work, I need to select the "value base field" option when selecting the field for the Metric Value. If I Select the field by the alias, e.g. in my case temp1, the link is not displayed (please refer to the Screenshots). Is there a way to specify the exact data links that should be displayed in each Metric value ? By the way, I'm running Grafana 9.4.3.
I Would be glad for an reply
regards
Christoph

here the working version

@ChristophEbler
Copy link

222691324-2bdea26a-5e4a-41fc-8616-46d7c56b1188
222691063-05c4d5db-676e-4cec-a2a5-49e3600de782

@mellieA
Copy link
Contributor

mellieA commented Mar 17, 2023

@ChristophEbler we've added more steps to our docs but they're in the next version here:

https://grafana.com/docs/grafana/next/panels-visualizations/visualizations/canvas/#data-links

@ChristophEbler
Copy link

Thanks a lot works grate !

@Hipska
Copy link
Contributor

Hipska commented Jul 3, 2023

I can't to get this mouseover to become visible (nor the link on click).

I followed the docs and am running v10.0.1 on Safari, Chrome, Firefox (macOS)

@PatiDeja
Copy link

I'm running v10.1.1 on Chrome. My data links also stopped working after one of the upgrades.

@kasaranenikarthik
Copy link

Same with me. I'm using v10.1.5 locally. Datalink disappears soon after I click and try moving towards it. Same case once I save my dashboard and share it with users.

@nmarrs
Copy link
Contributor

nmarrs commented Oct 26, 2023

Hi @kasaranenikarthik, @Hipska, and @PatiDeja - I'm sorry to hear that this feature isn't working anymore :/ would it be possible for you to provide a debug panel json for one of the panels you are having issues with?

I just tested this on latest main (set up following the docs) and didn't have any issues 🤔

canvas.datalink.support.mov

@kasaranenikarthik
Copy link

kasaranenikarthik commented Oct 27, 2023

@nmarrs Thanks for getting back to me. It would be difficult to share the panel as it's on office network. But my elements are stacked exactly like in this #70079 (near to each other). I think placing element with datalink near to any other element could possibly be the issue (I'm not sure though ..just a thought).

Also, another issue with canvas, I have canvas bigger than the size of my screen. Once I share, users are able to see only content equal to their screen size. Request for a horizontal and vertical scroll bars (even when editing the panel).

@pprkut
Copy link

pprkut commented Nov 16, 2023

I played around with this today in grafana 10.2.1. I noticed that if I add a data link for the entire panel, the tooltip displays for every element. I can click the element and then move to the tooltip and click the link (but I have to click the element, otherwise it just disappears before I can click the link)
However, if I add the data link for a specific field using a field override, the link is seemingly completely ignored. I'll see if I can come up with a demo dashboard, but it will take some time. In the meantime, FYI 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Canvas: Add tooltip for data links Canvas: Support data links